
<script language="javascript" src="modules/VoteDataCenter/pnajax/ajax_list_village.js"></script>
<fieldset>
  <legend>&nbsp;Report&nbsp;filter&nbsp;^^</legend>
  <form method=post action="<!--[pnmodurl modname='VoteDataCenter' type='remark' func='report']-->">
      <span id="form_province">
        <!--[if $smarty.request.form.pro_id]-->
          <!--[selector_object_array_ex 
                modname="VoteDataCenter" 
                class="Province" 
                field="id" 
                displayField="name"  
                name="form[pro_id]" 
                selectedValue=$smarty.request.form.pro_id
                allValue="0"
                allText="ทุกจังหวัด"
                sort="pro_name"
                onChange="getDistrictByProvinceID()"

          ]-->
        <!--[else]-->
          <!--[selector_object_array_ex 
                modname="VoteDataCenter" 
                class="Province" 
                field="id" 
                displayField="name"  
                name="form[pro_id]" 
                selectedValue=$form.id 
                allValue="0"
                allText="ทุกจังหวัด"
                sort="pro_name"
                onChange="getDistrictByProvinceID()"
          ]-->
        <!--[/if]-->
      </span>
      <span id="form_district">
          <!--[if (isset($smarty.request.form.dis_id) || $smarty.request.form.dis_id == 0) && $smarty.request.form.pro_id]-->
            <!--[selector_object_array_ex modname="VoteDataCenter" 
                    class="District" 
                    field="id" 
                    displayField="name"  
                    name="form[dis_id]" 
                    selectedValue=$smarty.request.form.dis_id
                    queryField = dis_pro_id
                    queryValue = $smarty.request.form.pro_id
                    allValue="0"
                    allText="ทุกอำเภอ"
                    sort="dis_name"
                    onChange="getTambonByDistrictID()"
            ]-->
          <!--[else]-->

          <!--[/if]-->
      </span>
      <span id="form_tambon">
          <!--[if $smarty.request.form.dis_id && $smarty.request.form.pro_id && ($smarty.request.form.tam_id || $smarty.request.form.tam_id == 0 )]-->
            <!--[selector_object_array_ex 
                    modname="VoteDataCenter" 
                    class="Tambon" 
                    field="id" 
                    displayField="name"  
                    name="form[tam_id]" 
                    selectedValue=$smarty.request.form.tam_id
                    queryField = tam_dis_id
                    queryValue = $smarty.request.form.dis_id
                    allValue="0"
                    allText="ทุกตำบล"
                    sort="tam_name"
            ]-->
          <!--[else]-->

          <!--[/if]-->
      </span>
    <input type="submit" value="submit">
  </form>
</fieldset>

<fieldset>
  <legend>&nbsp;Data&nbsp;</legend>
  <!--[if $objectArray]-->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>
      Google Visualization API Sample
    </title>
    <script type="text/javascript" src="http://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load('visualization', '1', {packages: ['corechart']});
    </script>
    <script type="text/javascript">
      function drawVisualization() {
        // Create and populate the data table.
        var data = new google.visualization.DataTable();
        data.addColumn('string', 'พรรค');
        data.addColumn('number', 'จำนวน');
        data.addRows(3);
        data.setValue(0, 0, 'ประชาธิปัตย์');
        data.setValue(0, 1, <!--[$sum_count_we]-->);
        data.setValue(1, 0, 'เพื่อไทย');
        data.setValue(1, 1, <!--[$sum_count_they]-->);
        data.setValue(2, 0, 'ยังไม่ตัดสินใจ');
        data.setValue(2, 1, <!--[$sum_all_count_unknown]-->);
        // Create and draw the visualization.
        new google.visualization.PieChart(document.getElementById('visualization')).
            draw(data, {title:"ผลหยั่งเสียงจากแกนตำบล และแกนหมู่บ้าน"});
      }
      
      google.setOnLoadCallback(drawVisualization);
    </script>
  </head>
  <body style="font-family: Arial;border: 0 none;">
<table>
<tr>
  <td align="center">
    <div id="visualization" style="width: 800px; height: 400px;">
    </div>
  </td>
</tr>
</table>
    
  </body>
</html>

  <table  width="100%">
    <tr bgcolor="#99CCCC">
      <th width="10%" align="center">หมู่ที่</th>
      <th width="30%" align="center">ผู้มีสิทธิทั้งหมด</th>
      <th width="20%" align="center">ประชาธิปัตย์</th>
      <th width="20%" align="center">เพื่อไทย</th>
      <th width="20%" align="center">ยังไม่ตัดสินใจ</th>
    </tr>
     <!--[foreach from=$objectArray item=item]-->
      <tr align="right" bgcolor="<!--[cycle values='#FFFFFF,#E8EFF7']-->">
        <td><!--[$item.aco_addr_moo]--></td>
        <td><!--[$item.count_all]--></td>
        <td><!--[$item.count_we]--></td>
        <td><!--[$item.count_they]--></td>
        <td><!--[$item.count_unknown]--></td>
      </tr>
     <!--[/foreach]-->
      <tr align="right" bgcolor="<!--[cycle values='#FFFFFF,#E8EFF7']-->">
        <th ><b>รวม</b></td>
        <th><!--[$sum_count_all]--></th>
        <th><!--[$sum_count_we]--></th>
        <th><!--[$sum_count_they]--></th>
        <th><!--[$sum_all_count_unknown]--></th>
      </tr>
  </table>

    <table>
      <tr>
        <th colspan="2">[สรุปผล]</th>
      </tr>
      <tr>
        <th>
          เงื่อนไข
        </th>
        <th>
          จำนวน
        </th>
        <th colspan="2" align="center">
          คิดเป็น
        </th>
      </tr>
      <tr>
        <td>
          - เลือกประชาธิปปัตย์&nbsp;&nbsp;
        </td>
        <td>
          <!--[$sum_count_we]-->&nbsp;&nbsp;
        </td>
        <td align="right">
          <!--[php]-->
            $sum_count_all = $this->get_template_vars('sum_count_all');
            $sum_count_we = $this->get_template_vars('sum_count_we');
            echo number_format(($sum_count_we*100)/$sum_count_all, 2);
          <!--[/php]-->
        </td>
        <td align="left">
          %
        </td>
      </tr>
      <tr>
        <td>
          - เลือกเพื่อไทย&nbsp;&nbsp;
        </td>
        <td>
          <!--[$sum_count_they]-->&nbsp;&nbsp;
        </td>
        <td align="right">
          <!--[php]-->
            $sum_count_they = $this->get_template_vars('sum_count_they');
            echo number_format(($sum_count_they*100)/$sum_count_all, 2);
          <!--[/php]-->
        </td>
        <td align="left">
          %
        </td>
      </tr>
      <tr>
        <td>
          - ไม่มีแกน&nbsp;&nbsp;
        </td>
        <td>
          <!--[$sum_count_none_canvasser]-->&nbsp;&nbsp;
        </td>
        <td align="right">
          <!--[php]-->
            $sum_count_none_canvasser = $this->get_template_vars('sum_count_none_canvasser');
            echo number_format(($sum_count_none_canvasser*100)/$sum_count_all, 2);
          <!--[/php]-->
        </td>
        <td align="left">
          %
        </td>
      </tr>
      <tr>
        <td>
          - ยังไม่ตัดสินใจ&nbsp;&nbsp;
        </td>
        <td>
          <!--[$sum_count_unknown]-->&nbsp;&nbsp;
        </td>
        <td align="right">
          <!--[php]-->
            $sum_count_unknown = $this->get_template_vars('sum_count_unknown');
            echo number_format((($sum_count_unknown*100)/$sum_count_all), 2, ".", ",");
          <!--[/php]-->
        </td>
        <td align="left">
          %
        </td>
      </tr>
    </table>
  <!--[else]-->
    Data not  found.
  <!--[/if]-->
</form>
</fieldset>
